<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateFlowHistoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('flow_histories', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('owner_id')->comment('所有者ID');
            $table->string('owner_name',255)->comment('所有者姓名');
            $table->integer('admin_id')->comment('面试官ID');
            $table->string('admin_name',255)->comment('面试官姓名');
            $table->integer('resume_id')->comment('简历ID');
            $table->integer('company_id')->comment('公司ID');
            $table->string('company_name',255)->comment('公司名称');
            $table->integer('flow_id')->nullable()->comment('流程ID');
            $table->string('flow_name',255)->nullable()->comment('流程名称');
            $table->integer('step_id')->nullable()->comment('步骤ID');
            $table->string('step_name',255)->nullable()->comment('步骤名称');
            $table->tinyInteger('check_status')->default(0)->comment('审核状态 1:通过，2未通过3：待定');
            $table->tinyInteger('ask_status')->default(0)->comment('邀约状态 1：通过 2：未通过 3：待定');
            $table->string('reason',255)->nullable()->comment('失败原因');
            $table->integer('stime')->comment('开始时间');
            $table->integer('etime')->nullable()->comment('结束时间');
            $table->integer('count')->default(0)->comment('轮次');
            $table->string('address',255)->nullable()->comment('面试地点');
            $table->tinyInteger('status')->default('0')->comment('删除状态 0:正常，1删除');
            $table->integer('created_at')->comment('创建时间');
            $table->integer('updated_at')->comment('最后更新时间');
        });
        DB::statement("ALTER TABLE `flow_histories` comment '历史流程'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('flow_histories');
    }
}
